package com.szrt.oa.menu.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.szrt.oa.base.service.impl.BaseServiceImpl;
import com.szrt.oa.menu.dao.MenuDao;
import com.szrt.oa.menu.entity.MenuEntity;
import com.szrt.oa.menu.service.MenuService;

@Service
public class MenuServiceImpl extends BaseServiceImpl<MenuEntity> implements MenuService{

	@Autowired
	private MenuDao menuDao;
	
	
	@Transactional(readOnly=true)
	@Override
	public Map<String, Object> findMenuByUserId(int id) {
		
		Map<String, Object> map=new HashMap<String, Object>();
		
		try {
			List<MenuEntity> listMenu = menuDao.findMenuByUserId(id);
			map.put("listMenu", listMenu);
			map.put("code", "200");
			
		} catch (Exception e) {
			map.put("listMenu", "null");
			map.put("code", "333");
			e.printStackTrace();
		}
		
		return map;
	}

}
